<template>
  <transition name="toast">
    <div v-if="show" class="toast" :class="type">
      {{ message }}
    </div>
  </transition>
</template>

<script>
export default {
  name: 'Toast',
  props: {
    show: Boolean,
    message: String,
    type: {
      type: String,
      default: 'info',
      validator: value => ['success', 'error', 'info'].includes(value)
    }
  }
}
</script>

<style scoped>
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 4px;
  color: white;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.success {
  background-color: #4CAF50;
}

.error {
  background-color: #f44336;
}

.info {
  background-color: #2196F3;
}

.toast-enter-active, .toast-leave-active {
  transition: all 0.3s ease;
}

.toast-enter, .toast-leave-to {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
}
</style> 